package com.qd.panda.service.card.collect;

import com.cdqidi.util.RedissonLockTemplate;
import com.qd.common.panda.domain.entity.card.collect.ReceiveCardsDTO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * 测试使用
 *
 * @author sjk
 * @create 2023-11-16 11:32
 * @since 1.0.0
 */
@Service
@RequiredArgsConstructor
public class ReceiveTestService {
    private final ReceiveCardService receiveCardService;

    public void receiveCards(String userId, String mobile, ReceiveCardsDTO receiveCardsDTO) {
        //加锁
        RedissonLockTemplate.execute(receiveCardsDTO.getCid(), () -> {
            receiveCardService.receiveCards(userId, mobile, receiveCardsDTO);
            return null;
        }, 60, -1);
    }
}